/*
 * circbuffer.h
 *
 *  Created on: 2015-03-19
 *      Author: atreyu
 */

#ifndef CIRCBUFFER_H_
#define CIRCBUFFER_H_

#include "inc/lm4f120h5qr.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/interrupt.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "driverlib/adc.h"

#include "uart.h"
#include "definitions.h"
#include "itoa.h"

typedef struct
{
    void *buffer;     // data buffer
    void *buffer_end; // end of data buffer
    size_t capacity;  // maximum number of items in the buffer
    size_t count;     // number of items in the buffer
    size_t sz;        // size of each item in the buffer
    void *head;       // pointer to head
    void *tail;       // pointer to tail
} cBuffer;

typedef struct linkedlist
{
	int adcValue;
	char item;
	struct linkedlist *next;

} linkedlist;

linkedlist adcBuff;

int init_cBuffer(cBuffer *cB, size_t capacity, size_t sz);
void cBuffer_free(cBuffer *cB);
int cBuffer_push_end(cBuffer *cB, const void *item);
int cBuffer_pop_top(cBuffer *cB, void *item);
int cBuffer_normalize(cBuffer *cB);
void cBuffer_print(cBuffer *cB);

linkedlist *node;


#endif /* CIRCBUFFER_H_ */
